(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
length(cons(x, l)) →+ s(length(l))
gives rise to a decreasing loop by considering the right hand sides subterm at position [0].
The pumping substitution is [l / cons(x, l)].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0'
length(cons(x, l)) → s(length(l))
ge(u, 0') → true
ge(0', s(v)) → false
ge(s(u), s(v)) → ge(u, v)
S is empty.
Rewrite Strategy: FULL
(5) SlicingProof (LOWER BOUND(ID) transformation)
Sliced the following arguments:
cons/0
(6) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(l)) → l
length(nil) → 0'
length(cons(l)) → s(length(l))
ge(u, 0') → true
ge(0', s(v)) → false
ge(s(u), s(v)) → ge(u, v)
S is empty.
Rewrite Strategy: FULL
(7) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(8) Obligation:
TRS:
Rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(l)) → l
length(nil) → 0'
length(cons(l)) → s(length(l))
ge(u, 0') → true
ge(0', s(v)) → false
ge(s(u), s(v)) → ge(u, v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
(9) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
nthtail,
ge,
lengthThey will be analysed ascendingly in the following order:
ge < nthtail
length < nthtail
(10) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
l)) →
llength(
nil) →
0'length(
cons(
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(gen_nil:cons4_0(x))
gen_s:0'5_0(0) ⇔ 0'
gen_s:0'5_0(+(x, 1)) ⇔ s(gen_s:0'5_0(x))
The following defined symbols remain to be analysed:
ge, nthtail, length
They will be analysed ascendingly in the following order:
ge < nthtail
length < nthtail
(11) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
ge(
gen_s:0'5_0(
n7_0),
gen_s:0'5_0(
n7_0)) →
true, rt ∈ Ω(1 + n7
0)
Induction Base:
ge(gen_s:0'5_0(0), gen_s:0'5_0(0)) →RΩ(1)
true
Induction Step:
ge(gen_s:0'5_0(+(n7_0, 1)), gen_s:0'5_0(+(n7_0, 1))) →RΩ(1)
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(12) Complex Obligation (BEST)
(13) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
l)) →
llength(
nil) →
0'length(
cons(
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(gen_nil:cons4_0(x))
gen_s:0'5_0(0) ⇔ 0'
gen_s:0'5_0(+(x, 1)) ⇔ s(gen_s:0'5_0(x))
The following defined symbols remain to be analysed:
length, nthtail
They will be analysed ascendingly in the following order:
length < nthtail
(14) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
length(
gen_nil:cons4_0(
n282_0)) →
gen_s:0'5_0(
n282_0), rt ∈ Ω(1 + n282
0)
Induction Base:
length(gen_nil:cons4_0(0)) →RΩ(1)
0'
Induction Step:
length(gen_nil:cons4_0(+(n282_0, 1))) →RΩ(1)
s(length(gen_nil:cons4_0(n282_0))) →IH
s(gen_s:0'5_0(c283_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(15) Complex Obligation (BEST)
(16) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
l)) →
llength(
nil) →
0'length(
cons(
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
length(gen_nil:cons4_0(n282_0)) → gen_s:0'5_0(n282_0), rt ∈ Ω(1 + n2820)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(gen_nil:cons4_0(x))
gen_s:0'5_0(0) ⇔ 0'
gen_s:0'5_0(+(x, 1)) ⇔ s(gen_s:0'5_0(x))
The following defined symbols remain to be analysed:
nthtail
(17) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol nthtail.
(18) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
l)) →
llength(
nil) →
0'length(
cons(
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
length(gen_nil:cons4_0(n282_0)) → gen_s:0'5_0(n282_0), rt ∈ Ω(1 + n2820)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(gen_nil:cons4_0(x))
gen_s:0'5_0(0) ⇔ 0'
gen_s:0'5_0(+(x, 1)) ⇔ s(gen_s:0'5_0(x))
No more defined symbols left to analyse.
(19) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
(20) BOUNDS(n^1, INF)
(21) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
l)) →
llength(
nil) →
0'length(
cons(
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
length(gen_nil:cons4_0(n282_0)) → gen_s:0'5_0(n282_0), rt ∈ Ω(1 + n2820)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(gen_nil:cons4_0(x))
gen_s:0'5_0(0) ⇔ 0'
gen_s:0'5_0(+(x, 1)) ⇔ s(gen_s:0'5_0(x))
No more defined symbols left to analyse.
(22) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
(23) BOUNDS(n^1, INF)
(24) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
l)) →
llength(
nil) →
0'length(
cons(
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
gen_nil:cons4_0 :: Nat → nil:cons
gen_s:0'5_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
Generator Equations:
gen_nil:cons4_0(0) ⇔ nil
gen_nil:cons4_0(+(x, 1)) ⇔ cons(gen_nil:cons4_0(x))
gen_s:0'5_0(0) ⇔ 0'
gen_s:0'5_0(+(x, 1)) ⇔ s(gen_s:0'5_0(x))
No more defined symbols left to analyse.
(25) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'5_0(n7_0), gen_s:0'5_0(n7_0)) → true, rt ∈ Ω(1 + n70)
(26) BOUNDS(n^1, INF)